package com.itheima.集合;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;

public class 集合Demo1 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        LinkedList<String> list1=new LinkedList<String>();
        list1.add("aaa");
        list1.add("bbb");
        list1.add("ccc");
        list1.add("ddd");
        for (int i = 0; i < list1.size(); i++) {
            System.out.println(list1.get(i));
        }
        System.out.println(".........................................");
        Iterator<String> iterator = list1.iterator();
        for (String s : list1) {
            System.out.println(s);
        }
        System.out.println(".........................................");
        list1.addFirst("eee");
        System.out.println(list1);
        list1.addLast("fff");
        System.out.println(list1);
        String first = list1.getFirst();
        System.out.println(first);
        String last = list1.getLast();
        System.out.println(last);
        String s = list1.removeFirst();
        System.out.println(list1);
        String s1 = list1.removeLast();
        System.out.println(list1);
    }
}
